<extend name="Public/base" />

<block name="body">
    <form action="{:U('GroupPurchase/orderExport')}" method="POST" target="_blank">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>订单管理
                <input type="submit" value="批量导出" class="confirm btn btn-default">
                <a href="{:U('GroupPurchase/orderPush')}" class="btn btn-default ajax-get confirm">上推数据</a>
                <a href="{:U('GroupPurchase/orderPull')}" class="btn confirm ajax-get btn-default">下拉数据</a>
            </h2>
        </div>

        <div class="cf">
            <!-- 高级搜索 -->
            <div class="search-form fr cf">
                <div class="sleft">
                    <input type="text" name="b_date" class="text input-large time" value="{:I('b_date')}" placeholder="请选择开始时间"   style="height: 30px;width:180px" />
                </div>
                <div class="sleft">
                    <input type="text" name="e_date" class="text input-large time" value="{:I('e_date')}" placeholder="请选择结束时间"   style="height: 30px;width:180px" />
                </div>
                <div class="sleft">
                    <select name="aid" id="aid" class="search-input" style="height: 30px;width:180px">
                        <option value="0">请选择...</option>
                        <volist name="data.areaList" id="vo">
                            <if condition="($vo.id eq $_aid)"> <option value={$vo.id} selected="selected">{$vo.areaName}</option>
                                <else /> <option value="{$vo.id}">{$vo.areaName}</option>
                            </if>
                        </volist>
                    </select>
                </div>
                <div class="sleft">
                    <select name="status" id="status" class="search-input" style="height: 30px;width:180px">
                        <option value="">请选择...</option>
                        <option value="1000" {$_status=="1000"?'selected':''}>未付款</option>
                        <option value="2000" {$_status=="2000"?'selected':''}>未出单</option>
                        <option value="3000" {$_status=="3000"?'selected':''}>未打包</option>
                        <option value="4000" {$_status=="4000"?'selected':''}>未领取</option>
                        <option value="5000" {$_status=="5000"?'selected':''}>未分配</option>
                        <option value="6000" {$_status=="6000"?'selected':''}>未领件</option>
                        <option value="7000" {$_status=="7000"?'selected':''}>未派送</option>
                        <option value="8000" {$_status=="8000"?'selected':''}>未签收</option>
                        <option value="9000" {$_status=="9000"?'selected':''}>未评价</option>
                        <option value="9999" {$_status=="9999"?'selected':''}>已评价</option>
                        <option value="-1" {$_status=="-1"?'selected':''}>用户撤消</option>
                        <option value="-2" {$_status=="-1"?'selected':''}>平台撤消</option>
                    </select>
                </div>
                <div class="sleft">
                    <input type="text" name="dayId" class="search-input" value="{:I('dayId')}"  placeholder="当天订单序号" style="height: 30px;width:100px">
                </div>
                <div class="sleft">
                    <input type="text" name="id" class="search-input" value="{:I('id')}"  placeholder="订单编号查询订单" style="height: 30px;width:150px">
                    <a class="sch-btn" href="javascript:;" id="search" url="{:U('order')}"><i class="btn-search"></i></a>
                </div>
            </div>
        </div>

        <!-- 数据列表 -->

        <div class="data-table table-striped">

            <table class="table table-hover">
                <thead>
                    <tr>
                        <th class="row-selected row-selected" style="width: 5%"><input class="check-all" type="checkbox"/></th>
                        <th style="width: 5%">属区</th>
                        <th style="width: 10%">订单编号</th>
                        <th style="width: 5%">金额</th>
                        <th style="width: 10%">所属团购</th>
                        <th style="width: 10%">支付方式</th>
                        <th style="width: 10%">收货人</th>
                        <th style="width: 5%">状态</th>
                        <th style="width: 8%">同步状态</th>
                        <th style="width: 10%">下单时间</th>
                        <th style="width: 10%">序号</th>
                        <th style="width: 10%">操作</th>
                    </tr>
                </thead>
                <tbody>
                <notempty name="_list">
                    <volist name="_list" id="vo">
                        <tr  valign="top">
                            <td><input class="ids" type="checkbox" name="oid[]" value="{$vo.orderid}" /></td>
                            <td>{$vo.areaId|get_area_name} </td>	
                            <td>{$vo.orderid} </td>
                            <td><span style="color: red;font-weight: bold;">{$vo.finalAmount}</span></td>
                            <td>{$vo.gpName} </td>
                            <td>{$vo.payway} </td>
                            <td>{$vo.toName} </td>
                            <td>{$vo.status_text} </td>
                            <td>{$vo.syncStatus|sync_status}</td>
                            <td>{$vo.createDate|time_format} </td>
                            <td>{$vo.serialNo} </td>
                            <td>
                                <a href="{:U('GroupPurchase/orderDetails')}&orderid={$vo['orderid']}" class="btn btn-default">明细</a>
                                <a href="{:U('Map/changearea')}&ordertype=1&orderid={$vo['orderid']}" class="btn btn-primary">分区</a>
                                <!---
                                <eq name="vo.status" value="-2">
                                    <a href="#" class="btn btn-primary" style="background-color: red;">已撤销</a>
                                <else/>
                                    <a href="{:U('GroupPurchase/canelOrder')}&orderid={$vo['orderid']}" class="confirm ajax-get btn btn-danger">撤&nbsp;&nbsp;&nbsp;销</a>
                                </eq>
                                -->
                            </td>
                        </tr>
                    </volist>
                    <else/>
                    <td colspan="12" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>

            </table>

        </div>
        <div class="page">
            {$_page}
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('GroupPurchase/order')}');
        
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');

            var query = $('.search-form').find('input').serialize();
            var queryselect = $('.search-form').find('select').serialize();

            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            queryselect = queryselect.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            queryselect = queryselect.replace(/^&/g, '');

            if (url.indexOf('?') > 0) {
                url += '&' + query;
                url += '&' + queryselect;
            } else {
                url += '?' + query;
                url += '?' + queryselect;
            }

            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });

        $(function () {
            $('.time').datetimepicker({
                //format: 'yyyy-mm-dd hh:ii',
                format: 'yyyy-mm-dd hh:ii',
                language: "zh-CN",
                minView: 2,
                autoclose: true
            });
        });
    </script>
</block>
